/****************************************************************************************************** * SPIME ENGINE ******************************************************************************************************/ var SpimeEngine = {}; /****************************************************************************************************** * GLOBALS ******************************************************************************************************/ SpimeEngine.debugMode = false; //When set to true console logs will be shown SpimeEngine.arrangers = {}; // An array of all the arrangers in the page SpimeEngine.layouts = {}; //An array of all the layouts in the page SpimeEngine.captchaKey = (document.location.hostname == "127.0.0.1" || document.location.hostname == "localhost") ? "6LdmEiUUAAAAAJBHO4Pb7MdtE5Et1jN1Wk4wjOBr" : "6Lc2KCUUAAAAAGP2G2L0bhHTq_hcnbo_we19MIXA"; SpimeEngine.YTPlayers = {}; SpimeEngine.Geocoder = {}; SpimeEngine.GoogleMaps = {}; SpimeEngine.ecommerceSolution = ""; SpimeEngine.stripePaymentHandler = {}; SpimeEngine.stripePaymentParams = {}; SpimeEngine.scrollEnabled = true; SpimeEngine.finishedLoading = false; /****************************************************************************************************** * MAIN * called from body onLoad func ******************************************************************************************************/ SpimeEngine.start = function(){ $(document).ready(function() { SpimeEngine.updateParent({"deliver_to":"parent","action":"finished-loading"}); SpimeEngine.finishedLoading = true; }); try{ SpimeEngine.BeforeInit(); SpimeEngine.InitMaster(); var c = 0 SpimeEngine.getAllHolders().each(function(){ var currentHolder = $(this); // setTimeout(function(){ SpimeEngine.InitHolder(currentHolder); // },10 *c ) c++; }); SpimeEngine.initForms(); LightBox.initLinks(); SpimeEngine.initVideos(); if(typeof window["EditorHelper"] != "undefined"){ SpimeEngine.initMaps(); }else{//MAPSFIX SpimeEngine.initMapsEmbed(); } SpimeEngine.initDynamicStripes(); SpimeEngine.AttachHelperIfNeeded(); SpimeEngine.AfterInit(); SpimeEngine.initAnchors(); SpimeEngine.initProducts();//ECOMMERCE setTimeout(function(){ SpimeEngine.loadHighResImages(); },1500); SpimeEngine.initRawHTMLs(); var hasScrollEffects = $(".master.container").hasClass("scroll-effects"); var hasItemEnterEffects = $(".master.item-box.items-enter-effects").length > 0; //first init of sections visibility if (hasScrollEffects || hasItemEnterEffects || typeof window["EditorHelper"] != "undefined"){ SpimeEngine.handleScrollEffects(); } if (getParameterByName("show_site")){ $('body,html').animate({ scrollTop: $(document).height() }, 4000); setTimeout(function(){ $('body,html').animate({ scrollTop: 0 }, 2000); },4500) } }catch(err){ console.log(err); console.trace(); console.error("something went wrong... (Engine) " + err) var errorMessage = $("#error").html(); $("#content").html(errorMessage); } }; /****************************************************************************************************** * INIT * The following methods are only called once ******************************************************************************************************/ SpimeEngine.BeforeInit = function(){ SpimeEngine.UpdateDeviceClass(); var scrollingContainer = $(document); var hasScrollEffects = $(".master.container").hasClass("scroll-effects"); var hasItemEnterEffects = $(".master.item-box.items-enter-effects").length > 0; SpimeEngine.handleParallax(); scrollingContainer.unbind("scroll").bind("scroll",function(event){ if (SpimeEngine.scrollEnabled){ if(typeof window["EditorHelper"] != "undefined"){ EditorHelper.handleScroll(event); } if ("menu" in SpimeEngine.layouts){ if (typeof SpimeEngine.layouts["menu"].handleScroll != "undefined"){ SpimeEngine.layouts["menu"].handleScroll($("[data-preset-type-id='MENUS']"),$(this).scrollTop()); } } SpimeEngine.handleParallax(); if (hasScrollEffects || hasItemEnterEffects || typeof window["EditorHelper"] != "undefined"){ SpimeEngine.handleScrollEffects(); } } if (typeof popupStripeAppOnScroll == 'function') { setTimeout(function(){ popupStripeAppOnScroll(); },300); } }); }; SpimeEngine.disableScroll= function(){ SpimeEngine.scrollEnabled = false; $("body").addClass("no-scroll"); }; SpimeEngine.enableScroll= function(){ SpimeEngine.scrollEnabled = true; $("body").removeClass("no-scroll"); }; SpimeEngine.handleParallax = function(){ if ($("#xprs").is(".tablet-mode") || $("#xprs").is(".phone-mode")){ return; } $(".parallax50-bg").each(function( index ) { var relevant_bg_img = $(this); var relevant_bg = relevant_bg_img.closest(".master.item-box"); relevant_bg_top = relevant_bg.offset().top; relevant_bg_bottom = relevant_bg_top + relevant_bg.height(); if ( (window.scrollY + $(window).height()) > relevant_bg_top ) { if ( window.scrollY < relevant_bg_bottom ) { var pospos = (relevant_bg_top + relevant_bg.height()/2) - (window.scrollY + $(window).height()/1.2); pospos = pospos/3; relevant_bg_img.css("background-position-y", pospos+"px"); } } }); } SpimeEngine.handleScrollEffects = function(){ SpimeEngine.getAllHolders().filter(":visible").not(".header-box, #empty-stripe, .element-box").each(function(){ var currentStripe = $(this); var bufferChecker = Math.min(0.3 * $(this).outerHeight(), 150) var top_of_object = currentStripe.offset().top + bufferChecker; var bottom_of_window = $(window).scrollTop() + $(window).height(); /* If the object is completely visible in the window, fade it it */ if( bottom_of_window > top_of_object ){ currentStripe.addClass("visible-section"); currentStripe.removeClass("hidden-section"); } else { currentStripe.removeClass("visible-section"); currentStripe.addClass("hidden-section"); } }); }; var width = $(window).width(), height = $(window).height(); SpimeEngine.AfterInit = function(){ $("#loading").remove(); $(".master.container").css("visibility","visible"); var resizeFlag = "off"; window.onresize = function(event) { if(typeof event != "undefined" && event.target === window) { if($(window).width() == width || $(window).height() != height){ return; } if (resizeFlag == "off"){ resizeFlag = "waiting"; setTimeout(function(){ SpimeEngine.ArrangeAll(); resizeFlag = "off" }, 1500); } SpimeEngine.UpdateDeviceClass(); if(typeof window["EditorHelper"] != "undefined"){ EditorHelper.adjustUI(); } $(".master.item-box").each(function(index) { var win = $(window); var viewport = { top : win.scrollTop(), left : win.scrollLeft() }; viewport.bottom = viewport.top + win.height(); viewport.right = viewport.left + win.width(); if ( ($(this).position().top > (viewport.bottom)) || ($(this).position().bottom < (viewport.top)) ){ } else { SpimeEngine.ArrangeHolder($(this)) } }); } }; window.addEventListener("orientationchange", function() { SpimeEngine.UpdateDeviceClass(); $(".master.item-box").each(function(index) { var win = $(window); var viewport = { top : win.scrollTop(), left : win.scrollLeft() }; viewport.bottom = viewport.top + win.height(); viewport.right = viewport.left + win.width(); if ( ($(this).position().top > (viewport.bottom)) || ($(this).position().bottom < (viewport.top)) ){ } else { SpimeEngine.ArrangeHolder($(this)) } }); }, false); SpimeEngine.handleUnarranged(); if (SpimeEngine.ecommerceSolution == ""){ SpimeEngine.ecommerceSolution = $("body").attr("data-ecommerce-solution"); } if (SpimeEngine.ecommerceSolution == "DISABLED" || SpimeEngine.ecommerceSolution == "NONE"){ return; } if (typeof StripeCheckout == "undefined"){ var imosServer = $("body").attr("data-imos-server"); XPRSHelper.GET(imosServer + "/api/pk", {"osid":$("body").attr("data-osid")}, function(pk){ if (pk == "None"){ pk = (document.location.hostname == "localhost")? 'pk_test_QSMNJ1sezwb2M4OzwzXm9MNU' : 'pk_live_GN5B7PU5wgoCY6JWtxrIcuQr'; } $.getScript( "https://checkout.stripe.com/checkout.js", function( data, textStatus, jqxhr ) { SpimeEngine.stripePaymentHandler = StripeCheckout.configure({ key:pk, locale: 'auto', token: function(token,args) { for( ar in args){ SpimeEngine.stripePaymentParams[ar] = args[ar] } SpimeEngine.stripePaymentParams["stripeToken"] = token.id; SpimeEngine.stripePaymentParams["buyer_email"] = token.email; var splittedDomain = SpimeEngine.splitHostname(window.location.hostname); SpimeEngine.stripePaymentParams["domain"] = splittedDomain.domain + "." + splittedDomain.type; SpimeEngine.stripePaymentParams["subdomain"] = splittedDomain.subdomain; SpimeEngine.stripePaymentParams["store_name"] = $("body").attr("data-store-name").substring(0,22); XPRSHelper.POST(imosServer + "/api/payment", SpimeEngine.stripePaymentParams, function(result){ try{ if (typeof IMOS != "undefined"){ IMOS.trackGoal("Premium",{"offer_name":SpimeEngine.stripePaymentParams["description"],"amount":SpimeEngine.stripePaymentParams["amount"],"email":token.email}); } if (typeof imosSdk != "undefined"){ imosSdk.addPurchase(SpimeEngine.stripePaymentParams["description"], SpimeEngine.stripePaymentParams["amount"]); } }catch(err){} }, "json") }, closed: function () { } }); $(window).on('popstate', function() { handler.close(); }); }); }); } }; SpimeEngine.UpdateDeviceClass = function(){ var currentWinWidth = $("body").width(); var deviceClass = "desktop-mode"; var disableScrollEffects = false; if(currentWinWidth < 800){ deviceClass = "tablet-mode desktop-mode"; disableScrollEffects = true; } if (currentWinWidth < 500){ deviceClass = "phone-mode tablet-mode desktop-mode"; } var xprsHolder = $("#xprs"); xprsHolder.removeClass("desktop-mode tablet-mode phone-mode"); xprsHolder.addClass(deviceClass); var mainPage = xprsHolder.find(".main-page"); var forceDisable = mainPage.attr("data-force-disable"); if (mainPage.hasClass("disable_effects") && !disableScrollEffects && !forceDisable){ mainPage.removeClass("disable_effects"); } if (!mainPage.hasClass("disable_effects") && disableScrollEffects){ mainPage.addClass("disable_effects"); } }; SpimeEngine.handleUnarranged = function(){ if ($(".rearrange").length > 0){ setTimeout(function(){ $(".rearrange").each(function(){ $(this).removeClass("rearrange"); SpimeEngine.ArrangeHolder($(this)); }); SpimeEngine.handleUnarranged(); },200); } }; SpimeEngine.loadHighResImages = function(){ SpimeEngine.loadHighResImage($(".stripe_popup_app_hide .load-high-res").not("#no-image"),1600); var c = 0; $(".load-high-res").not(".from-feed").not("#no-image").each(function(){ var currentImg = $(this); setTimeout(function(){ SpimeEngine.loadHighResImage(currentImg); },10 *c ) c++; }); }; SpimeEngine.loadHighResImage = function(imgDiv,forceNewRes){ if (imgDiv.length == 0){ return; } imgDiv.removeClass("load-high-res") var currentSrc = imgDiv.css("background-image"); var currentWidth = imgDiv.width(); var currentHeight = imgDiv.height(); var newRes = Math.max(currentWidth,currentHeight); newRes = Math.min(newRes,1600); if(typeof window["EditorHelper"] != "undefined"){ newRes = 1600; } if (isNaN(newRes)){ newRes = 1200; } if (forceNewRes){ newRes = forceNewRes; } var backgroundZoom = imgDiv.css("background-size"); if (typeof backgroundZoom != "undefined"){ if (backgroundZoom.indexOf("%") != -1){ if (parseInt(backgroundZoom) > 100){ newRes = 1600; } }else if(backgroundZoom == "cover"){ var tempRes = Math.max(currentWidth,currentHeight); if (forceNewRes){ tempRes = forceNewRes; } tempRes*=2; tempRes = Math.min(tempRes,1600); newRes = tempRes; } } var newSrc = currentSrc.replace("=s300","=s"+newRes); var finalSrc = newSrc + "," +currentSrc imgDiv.css("background-image",finalSrc); setTimeout(function() { SpimeEngine.removeLowResimg(imgDiv); }, 1000); }; SpimeEngine.removeLowResimg = function(imgDiv) { var oldBg = imgDiv.css("background-image"); var bgArray = oldBg.split(','); if (bgArray.length>1) { imgDiv.css("background-image", bgArray[0]); } } SpimeEngine.initRawHTMLs = function(){ $(".main-page:not(.disable-raw-html) .raw-container, .main-page:not(.disable-raw-html) .preview-raw-container").not(".disable-raw-html").each(function() { SpimeEngine.initRawHTML($(this)); }); }; SpimeEngine.initRawHTML = function(htmlContainer,forceLoad, callback){ if(typeof window["EditorHelper"] != "undefined"){ if(htmlContainer.closest(".raw-wrapper").find(".page-app").length > 0) { htmlContainer.closest(".raw-wrapper").css({"min-height":"0px"}); } } if (htmlContainer.attr("data-static") == "false" || forceLoad){ var url = htmlContainer.attr("data-raw-content-url"); $.get(XPRSHelper.getStaticServerPath() + url,function(html){ if($("[data-block-script]").length > 0){ htmlContainer.html(SpimeEngine.unescapeHtml(html)) }else{ htmlContainer.html(html) } if(callback)callback(); }); } }; SpimeEngine.unescapeHtml = function(safe) { var temp = document.createElement("div"); temp.innerHTML = safe; var result = temp.childNodes[0].nodeValue; temp.removeChild(temp.firstChild); return result; } SpimeEngine.initProducts = function(){ SpimeEngine.ecommerceSolution = $("body").attr("data-ecommerce-solution"); $(".preview-price").not(".sold-out").each(function() { var pid = $(this).attr("data-product-id"); if (pid != "N/A"){ var relevantItem = $(this).closest(".item-box"); relevantItem.addClass("clickable"); if(typeof window["EditorHelper"] == "undefined"){ relevantItem.unbind("click").bind("click",function(e){ e.stopPropagation(); SpimeEngine.buyProduct(pid); }); } //disable lightbox relevantItem.find("a[data-link-type='LIGHTBOX']").each(function(){ $(this).unbind("click"); }); }else{ SpimeEngine.demoProduct() } }); $("a[data-link-type='BUY']").each(function() { var currentLink = $(this); currentLink.addClass("clickable"); currentLink.removeAttr("href"); currentLink.unbind("click").bind("click",function(e){ e.preventDefault(); e.stopPropagation(); var parent = $(this).closest(".item-box"); var previewPrice = parent.find(".preview-price").not(".sold-out"); if (previewPrice.length > 0){ var pid = previewPrice.attr("data-product-id"); if (pid != "N/A"){ SpimeEngine.buyProduct(pid); }else{ SpimeEngine.demoProduct() } }else{ SpimeEngine.demoProduct() } }); }); }; SpimeEngine.demoProduct = function(){ if (SpimeEngine.ecommerceSolution == "IMOS"){ return; } if (typeof showcart != "undefined"){ showcart(); } var demoProductText = "PRODUTO DE TESTE
(para adicionar um produto real, clique na opção ‘vender este produto’ no menu)" if (typeof XPRSTranslator != "undefined"){ demoProductText = XPRSTranslator.translateText(demoProductText); } $("#sr-cart-modal-productname").html(demoProductText); $("#sr-cart-modal-productprice").text("0.00"); var demoBlocker = $("
").attr("id","demo-blocker").css({"width":"100%","height":"100%","position":"absolute","top":"0px","left":"0px","z-index":"9999999999","cursor":"pointer"}).bind("click",function(e){ e.stopPropagation(); $("#sr-cartmodal").SRmodal('hide'); $(this).remove(); }); $("#sr-cartmodal").prepend(demoBlocker); }; SpimeEngine.buyProduct = function(pid){ if (SpimeEngine.ecommerceSolution == "IMOS"){ var shopId = $("body").attr("data-os-store-id") var priceElement = $("[data-product-id='" + pid + "']"); var openInProductPage = priceElement.closest(".master.item-box.show-product-inner-page").length > 0; var relevantItem = priceElement.closest(".item-box"); if (openInProductPage){ var absoluteUrl =$(".master.container").attr("data-absolute-path"); if (typeof EditorHelper == "undefined"){ window.location.href = SpimeEngine.getProductUrl(relevantItem.attr("id")); }else{ XPRSHelper.updateParent({"deliver_to":"parent","action":"navigate-viewer","vbid":"product/" + relevantItem.attr("id")}); } return } var productType = priceElement.attr("data-product-type"); if (!productType){ productType = "SERVICE"; } var relevantTitle = relevantItem.find(".preview-title").text(); SpimeEngine.stripePaymentParams["shop_id"] = shopId; SpimeEngine.stripePaymentParams["amount"] = SpimeEngine.parsePrice(priceElement); SpimeEngine.stripePaymentParams["description"] = relevantTitle; SpimeEngine.stripePaymentParams["name"] = $("body").attr("data-store-name"); SpimeEngine.stripePaymentParams["root_id"] = $("body").attr("data-root-id") SpimeEngine.stripePaymentParams["visitor_id"] = XPRSHelper.getXprsCookie("os_visitor") SpimeEngine.stripePaymentParams["product_id"] = pid; SpimeEngine.stripePaymentParams["currency"] = $("body").attr("data-default-currency"); SpimeEngine.stripePaymentParams["osid"] = $("body").attr("data-osid"); if (productType == "PHYSICAL"){ SpimeEngine.stripePaymentParams["shippingAddress"]=true; var shippingCost = $("body").attr("data-shipping-cost"); if (shippingCost){ shippingCost = parseInt(shippingCost); var shippingCostInCents = shippingCost * 100; SpimeEngine.stripePaymentParams["shipping_cost"] = shippingCostInCents SpimeEngine.stripePaymentParams["amount"] += shippingCostInCents; var currencyArr = {"USD":"$","EUR":"\u20ac","GBP":"\u00a3","BRL":"R$", "JPY":"\u00a5","NZD":"NZ$","SEK":"Kr","CHF":"CHF","NOK":"kr","MYR":"RM","SGD":"S$","AED":"\u062F.\u0625","PKR":"₨","THB":"฿","IDR":"Rp","PHP":"₱"}; var currencySymbol = "$" + SpimeEngine.stripePaymentParams["currency"]; if (SpimeEngine.stripePaymentParams["currency"] in currencyArr){ currencySymbol = currencyArr[SpimeEngine.stripePaymentParams["currency"]]; } SpimeEngine.stripePaymentParams["description"] += " ( + " + currencySymbol + shippingCost + " Shipping ) "; } }else{ SpimeEngine.stripePaymentParams["shippingAddress"]=false; } SpimeEngine.populateProductDetails(priceElement); SpimeEngine.stripePaymentHandler.open(SpimeEngine.stripePaymentParams); } }; SpimeEngine.getProductUrl = function(pid){ var rootId = $("body").attr("data-root-id"); var pageId = $(".master.container").attr("id"); var isInnerpage = rootId != pageId var pathName = location.pathname; if(pathName.endsWith("/")){ pathName = pathName.substring(0,pathName.length-1); } if (isInnerpage){ if (pathName.indexOf("/free/") != -1 || pathName.indexOf("/viewer/") != -1 || pathName.indexOf("/live/") != -1){ pathName = pathName.substring(0, pathName.lastIndexOf('/')); }else{ pathName = ""; } } return window.location.protocol + "//" + window.location.host + pathName + "/product/" + pid; }; SpimeEngine.parsePrice = function(priceElement){ if (priceElement.find(".real-price").length > 0){ strPrice = priceElement.find(".real-price").text(); }else{ strPrice = priceElement.text(); } var multiplyBy = 1; strPrice = strPrice.trim().toLowerCase().replace(",",""); strPrice = strPrice.split(" ")[0]; if (strPrice.indexOf("k") == strPrice.length - 1){ multiplyBy = 1000; } return parseInt((parseFloat(strPrice) * 100 * multiplyBy).toFixed(2)); }; SpimeEngine.populateProductDetails = function(priceElement){ var productImg = "none"; var item = priceElement.closest(".item-box"); var previewImage = item.find(".inner-pic.preview-element"); if (previewImage.length ==0){ previewImage = item.find(".image-source.preview-element"); } if (previewImage.length > 0){ var originalSrc = previewImage.css("background-image"); var imageSrc = originalSrc; if (imageSrc.indexOf(",") != -1){ imageSrc = imageSrc.split(",")[0]; imageSrc = imageSrc.replace('"','').replace('"',''); } imageSrc = imageSrc.replace("url(","").replace(")",""); var imageSrc = imageSrc.substring(0,imageSrc.indexOf("=s")); productImg = imageSrc; } SpimeEngine.stripePaymentParams["product_img"] = productImg; SpimeEngine.stripePaymentParams["product_name"] = item.find(".preview-title").text().replace(/ /gi, ' '); } SpimeEngine.initAnchors = function(){ $("a[data-link-type='ANCHOR']").each(function() { var currentLink = $(this); currentLink.unbind("click").bind("click",function(e){ e.preventDefault(); var target = $(this).attr("href"); var menuOffset = SpimeEngine.calculateScrollOffset(); if ($(this).closest(".preview-item-links.flipped").length > 0 ){ $(".links-menu-btn").click(); } if ($(target).length > 0) { targetOffset = $(target).offset().top - menuOffset; $('body,html').animate({ scrollTop: targetOffset }, 2000); } else { var pathName = SpimeEngine.getPathName(); var newTarget = window.location.protocol + "//" + window.location.host + pathName +target; window.location.href = newTarget; } }); }); }; SpimeEngine.getPathName = function() { var rootId = $("body").attr("data-root-id"); var pageId = $(".master.container").attr("id"); var isInnerpage = rootId != pageId var pathName = location.pathname; if(pathName.endsWith("/")){ pathName = pathName.substring(0,pathName.length-1); } if (isInnerpage){ if (pathName.indexOf("/edit_site/") != -1 || pathName.indexOf("/edit/") != -1 || pathName.indexOf("/free/") != -1 || pathName.indexOf("/viewer/") != -1 || pathName.indexOf("/live/") != -1){ pathName = pathName.substring(0, pathName.lastIndexOf('/')); }else{ pathName = ""; } } return pathName; } SpimeEngine.calculateScrollOffset = function(){ var scrollOffset = 0; if(typeof window["EditorHelper"] != "undefined"){ scrollOffset = 50; //topbar } var menuStripe = $(".menus-wrapper").closest(".master.item-box"); //if the menu exists if (menuStripe.length > 0){ var menuStripeSettings = menuStripe.find(".layout-settings"); var isFloatingMenu = menuStripeSettings.attr("data-menu_scroll") == "true"; var isLeftSideMenu = $(".left-menu-placeholder").length != 0; if (isFloatingMenu && !isLeftSideMenu){ var originalMenuHeight = menuStripe.outerHeight(true); var floatingMenuHeight = Math.max(50 + menuStripe.find(".preview-content-holder").outerHeight(true) - menuStripe.find(".preview-content-holder").height(),menuStripe.find(".preview-title-holder").height() + parseInt(menuStripe.find(".preview-content-holder").css("padding-top"))+ parseInt(menuStripe.find(".preview-content-holder").css("margin-top"))); if (menuStripe.is(".being-scrolled") || menuStripe.is(".force-transparency") || $(".left-menu-placeholder").length > 0){ originalMenuHeight = 0; } scrollOffset += originalMenuHeight + floatingMenuHeight; } } return scrollOffset; }; SpimeEngine.InitContainer = function(container,itemsClass, whatsNext){ SpimeEngine.DebugPrint("Init Container Start"); var containerArranger = SpimeEngine.getArranger(container); var items = container.children("#children").find(".item-box"); SpimeEngine.arrangers[containerArranger] = window[containerArranger + "_arranger"]; if (typeof SpimeEngine.arrangers[containerArranger] != "undefined"){ SpimeEngine.arrangers[containerArranger].init(container,items ,whatsNext); } }; SpimeEngine.initLayout = function(container, itemsClass){ var layoutSettings = container.find(".layout-settings"); var itemsLayout = layoutSettings.attr("data-type"); if (typeof itemsLayout == "undefined"){ itemsLayout = "bottom"; } if (typeof window[itemsLayout + "_layout"]== "undefined"){ console.error("layout " + itemsLayout + " needs to be loaded, thank you"); } SpimeEngine.layouts[itemsLayout] = window[itemsLayout + "_layout"]; SpimeEngine.layouts[itemsLayout].init(container,container.find(itemsClass)); SpimeEngine.setInitialShrinkerData(container.find(itemsClass),""); SpimeEngine.setInitialShrinkerData(container.find(itemsClass),"blocks-"); }; SpimeEngine.AttachHelperIfNeeded = function(){ if(typeof window["EditorHelper"] != "undefined"){ window.addEventListener("message", EditorHelper.receiveMessage, false); EditorHelper.bindHelperActions(); } }; /****************************************************************************************************** * ON RESIZE * The following methods are called every time the window is resized ******************************************************************************************************/ SpimeEngine.ArrangeAll = function(includeMaster){ if ($(".master.container").hasClass("left-menu-layout")){ $(".master.container").find("#children").first().css("width",$(window).innerWidth() - menu_layout.SCROLLBAR_WIDTH - $(".left-menu-placeholder").width()); $(".left-menu-placeholder").height($(window).height()); }else{ $(".master.container").find("#children").first().css("width",""); } SpimeEngine.ArrangeMaster(); SpimeEngine.getAllHolders().each(function(){ var currentHolder = $(this); SpimeEngine.ArrangeHolder(currentHolder,{"force_redraw":true}); }); LightBox.arrange(); }; SpimeEngine.arrangePopups = function(){ var popup = $(".stripe_popup_app"); if (popup.length > 0){ var popupRealTime = $("#popup-realtime"); var popupRealTimeStyle = ""; if (popupRealTime.length == 0){ popupRealTime = $("